<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="PeopleSearch.aspx.cs" Inherits="Matrix_network.PeopleLists.PeopleSearch" culture="auto" meta:resourcekey="PageResource2" uiculture="auto" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="PageHeaderContent" runat="server">
    <asp:Literal ID="Literal1" runat="server" Text="<%$ Resources: PageName%>" /> 
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
    <asp:GridView ID="SearchResultGridView" runat="server" 
        AutoGenerateColumns="False" DataKeyNames="id" 
    DataSourceID="MatrixDataSrc" 
    Width="383px" ShowHeader="False" CssClass="gridInfo" GridLines="None" >
        <Columns>
            <asp:ImageField DataImageUrlField="ava_id" 
                DataImageUrlFormatString="~/Photo/{0}" NullImageUrl="../Images/no_avatar.png">
                <ControlStyle Height="50px" Width="50px" />
            </asp:ImageField>
            <asp:BoundField DataField="name" SortExpression="name" />
            <asp:BoundField DataField="surname" SortExpression="surname"  />
            <%--<asp:HyperLinkField DataNavigateUrlFields="id" 
                DataNavigateUrlFormatString="~/SendMessage.aspx?toId={0}" Text="<%$ Resources: Write %>"/>--%>
            <asp:TemplateField >
                <ItemTemplate>
                    <asp:LinkButton ID="WriteBtn" runat="server" Text="<%$ Resources: Write %>" 
                        OnClick="WriteBtn_OnClick"
                        CommandArgument='<%# Eval("id").ToString() %>' />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField >
                <ItemTemplate>
                    <asp:LinkButton ID="AddFriendBtn" runat="server" Text="<%$ Resources: Add %>" 
                        OnClick="AddFriendBtn_OnClick"
                        CommandArgument='<%# Eval("id").ToString() %>' />
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>
    <asp:SqlDataSource ID="MatrixDataSrc" runat="server" 
        ConnectionString="<%$ ConnectionStrings:TheMatrixNetConnectionString %>" 
        
        
        SelectCommand="SELECT ava_id, id, name, surname FROM users WHERE (name = @srchStr) OR (surname = @srchStr)">
        <SelectParameters>
            <asp:SessionParameter Name="srchStr" SessionField="SearchStr" />
        </SelectParameters>
    </asp:SqlDataSource>
</asp:Content>
